/*****************************************************
** Author:
** Date: 2019-11-13
*
*****************************************************/

#include <stdio.h>
#include <stdarg.h>

/**
 * @brief
 * @param  None
 * @retval None
 */
void hexdump(unsigned char *buf, int len, const char *str, ...)
{
	int i;

	va_list args;
 	va_start(args, str);
	vprintf(str, args);
	va_end(args);

	for (i = 0; i < len; ++i) {
		if (i % 16 == 0) {
			printf("\n%p:", buf + i);
		}
		printf(" %02x", buf[i]);
	}
	printf("\n");
}

void hexdump_int(unsigned int *buf, int len, const char *str, ...)
{
	int i;

	va_list args;
 	va_start(args, str);
	vprintf(str, args);
	va_end(args);

	for (i = 0; i < len; ++i) {
		if (i % 16 == 0) {
			printf("\n%p:", buf + i);
		}
		printf(" %08x", buf[i]);
	}
	printf("\n");
}

/* End of file */



